package cn.izeno.wx.models.web

import com.alibaba.fastjson.annotation.JSONField

class Message {
  @JSONField(name = "MsgId")
  lateinit var msgId: String

  @JSONField(name = "FromUserName")
  lateinit var fromUserName: String

  @JSONField(name = "ToUserName")
  lateinit var toUserName: String

  /**
   * - 1  文本消息
   *
   * - 3  图片消息
   * - 34 语音消息
   * - 43 视频消息
   * - 49 文件消息,链接
   *
   * - 37 申请加好友 [recommendInfo].username [recommendInfo].nickname [recommendInfo].content
   * - 42 推荐, 公众号，名片，等
   * - 51 激活某个聊天框，获取取消激活
   *
   * ## 10000 系统消息
   *
   * - 10000 & [content] 发出红包，请在手机上查看
   * - 10000 & [content] 收到红包，请在手机上查看
   * - 10000 & [content] 你邀请"nickName"加入了群聊
   * - 10000 & [content] 你将"nickName"移除了群聊
   * - 10000 & [content] "老婆"邀请"小凉快"加入了群聊
   * - 10000 & [content] "老婆"已成为新群主
   * - 10000 & [content] 你已成为新群主
   * - 10000 & [content] 群主已启用“群聊邀请确认”，群成员需群主确认才能邀请朋友进群。
   * - 10000 & [content] 该系统消息只能到手机端查看
   * - 10000 & [content] "Zeno"邀请你加入了群聊，群聊参与人还有：zi o、刘军
   * - 10000 & [content] "万万分身"修改群名为“改了吗”
   */
  @JSONField(name = "msgType")
  var msgType = 0

  /**
   * 群消息内容会以 `username:<br/>` 开头, /(@[^:]+):<br/>/
   */
  @JSONField(name = "Content")
  lateinit var content: String

  @JSONField(name = "Status")
  var status = 0

  @JSONField(name = "ImgStatus")
  var imgStatus = 0

  // 10 位时间戳
  @JSONField(name = "CreateTime")
  var createTime = 0L

  @JSONField(name = "VoiceLength")
  var voiceLength = 0

  @JSONField(name = "PlayLength")
  var playLength = 0

  @JSONField(name = "FileName")
  lateinit var filename: String

  @JSONField(name = "FileSize")
  lateinit var fileSize: String


  @JSONField(name = "MediaId")
  lateinit var mediaId: String


  @JSONField(name = "")
  lateinit var Url: String


  @JSONField(name = "AppMsgType")
  var appMsgType = 0


  @JSONField(name = "StatusNotifyCode")
  var statusNotifyCode = 0


  @JSONField(name = "StatusNotifyUserName")
  lateinit var statusNotifyUserName: String


  @JSONField(name = "RecommendInfo")
  lateinit var recommendInfo: RecommendInfo


  @JSONField(name = "ForwardFlag")
  var forwardFlag = 0


  @JSONField(name = "AppInfo")
  lateinit var appInfo: AppInfo

  @JSONField(name = "HasProductId")
  var hasProductId = 0

  @JSONField(name = "Ticket")
  lateinit var ticket: String


  @JSONField(name = "ImgHeight")
  var imgHeight = 0


  @JSONField(name = "ImgWidth")
  var imgWidth = 0


  @JSONField(name = "SubMsgType")
  var subMsgType = 0


  @JSONField(name = "NewMsgId")
  var newMsgId = 0L


  @JSONField(name = "OriContent")
  lateinit var oriContent: String


  @JSONField(name = "EncryFileName")
  lateinit var encryFileName: String

  class AppInfo {
    @JSONField(name = "AppID")
    lateinit var appid: String
    @JSONField(name = "Type")
    var type = 0
  }

  companion object {
    const val TYPE_IMG = 3
    const val TYPE_INVOICE = 34
    const val TYPE_VIDEO = 43
    const val TYPE_SYSTEM = 10000
  }
}